import wtforms

from validators import BaseForm, BasePageForm


class MenuForm(BaseForm):
    """
    菜单表单校验类
    """
    id = wtforms.IntegerField()
    appCode = wtforms.StringField("应用编码")
    parentId = wtforms.StringField("父ID", [wtforms.validators.DataRequired(message="父ID不能为空")])
    name = wtforms.StringField("菜单名称", [wtforms.validators.DataRequired(message="菜单名称不能为空")])
    code = wtforms.StringField("唯一编码", [wtforms.validators.DataRequired(message="唯一编码不能为空")])
    pids = wtforms.StringField("父ID集合")
    type = wtforms.StringField("菜单类型<sys_menu_type>")
    sort = wtforms.StringField("排序")
    path = wtforms.StringField("路由地址")
    component = wtforms.StringField("组件地址")
    icon = wtforms.StringField("菜单图标")
    isShow = wtforms.StringField("是否显示")
    isLink = wtforms.StringField("是否链接")
    url = wtforms.StringField("外部链接地址")
    enabled = wtforms.StringField("是否启用")
    openType = wtforms.StringField("打开方式<sys_menu_open_type>")
    isCache = wtforms.StringField("是否缓存")
    isSync = wtforms.StringField("是否同步")
    variable = wtforms.StringField("额外参数JSON")
    createUser = wtforms.StringField("创建用户")
    updateUser = wtforms.StringField("更新用户")


class MenuPageForm(BasePageForm):
    """
    菜单分页校验类
    """
    pass
